<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
<script type="text/javascript">
window.onload =function (){
	var oUl = document.getElementById('ul1');
	//alert(oUl.firstElementChild);   //=>null
	var oFirst = oUl.firstElementChild || oUl.fisrtChild;
	//alert(oFirst);	//=>undefined
/*	if ( oFirst ) {
		oFirst.style.background = 'red';
	} else {
		alert( '没有子节点可以设置' );
	}
*/
	if ( oUl.children[0] ) {
		oUl.children[0].style.background = 'red';
	} else {
		alert( '没有子节点可以设置' );
	}

}
</script>
</head>
<body>
	<ul id="ul1">
    </ul>
</body>
</html>